package org.creativor.rayson.transport.server.transfer;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.creativor.rayson.api.TransferArgument;
import org.creativor.rayson.api.TransferSocket;
import org.creativor.rayson.demo.proxy.DemoTransferArgument;
import org.creativor.rayson.demo.server.DemoTransferService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The class <code>TransferCallTest</code> contains tests for the class <code>{@link TransferCall}</code>.
 * <p>
 * Copyright Creativor Studio (c) 2011
 *
 * @generatedBy CodePro at 11-5-7 上午2:56
 * @author Nick Zhang
 * @version $Revision: 1.0 $
 */
public class TransferCallTest {
	/**
	 * Run the TransferCall(TransferInvoker,TransferArgument,TransferSocket) constructor test.
	 *
	 * @throws Exception
	 *
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testTransferCall_1()
		throws Exception {
		TransferInvoker invoker = new TransferInvoker((short) 1, new DemoTransferService(), Object.class.getMethods()[0]);
		TransferArgument argument = new DemoTransferArgument("");
		TransferSocket transferSocket = null;

		TransferCall result = new TransferCall(invoker, argument, transferSocket);

		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("{argument: org.creativor.rayson.demo.api.DemoTransferArgument@25724e, transfer code: 1}", result.toString());
	}

	/**
	 * Run the void process() method test.
	 *
	 * @throws Exception
	 *
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testProcess_1()
		throws Exception {
		TransferCall fixture = new TransferCall(new TransferInvoker((short) 1, new DemoTransferService(), Object.class.getMethods()[0]), new DemoTransferArgument(""), (TransferSocket) null);

		fixture.process();

		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this test:
		//    java.lang.NullPointerException
		//       at org.creativor.rayson.transport.server.transfer.TransferCall.process(TransferCall.java:46)
	}

	/**
	 * Run the void process() method test.
	 *
	 * @throws Exception
	 *
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testProcess_2()
		throws Exception {
		TransferCall fixture = new TransferCall(new TransferInvoker((short) 1, new DemoTransferService(), Object.class.getMethods()[0]), new DemoTransferArgument(""), (TransferSocket) null);

		fixture.process();

		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this test:
		//    java.lang.NullPointerException
		//       at org.creativor.rayson.transport.server.transfer.TransferCall.process(TransferCall.java:46)
	}

	/**
	 * Run the String toString() method test.
	 *
	 * @throws Exception
	 *
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testToString_1()
		throws Exception {
		TransferCall fixture = new TransferCall(new TransferInvoker((short) 1, new DemoTransferService(), Object.class.getMethods()[0]), new DemoTransferArgument(""), (TransferSocket) null);

		String result = fixture.toString();

		// TODO: add additional test code here
		assertEquals("{argument: org.creativor.rayson.demo.api.DemoTransferArgument@8f8ecd, transfer code: 1}", result);
	}

	/**
	 * Perform pre-test initialization.
	 *
	 * @throws Exception
	 *         if the initialization fails for some reason
	 *
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Before
	public void setUp()
		throws Exception {
		// TODO: add additional set up code here
	}

	/**
	 * Perform post-test clean-up.
	 *
	 * @throws Exception
	 *         if the clean-up fails for some reason
	 *
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@After
	public void tearDown()
		throws Exception {
		// TODO: add additional tear down code here
	}

	/**
	 * Launch the test.
	 *
	 * @param args the command line arguments
	 *
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	public static void main(String[] args) {
		new org.junit.runner.JUnitCore().run(TransferCallTest.class);
	}
}